####### Compiler, tools and options

CC            = gcc
CXX           = g++
LEX           = flex
YACC          = yacc
DEFINES       = -DQT_GUI_LIB -DQT_CORE_LIB -DQT_TOOLS_INSTALLED
CFLAGS        = -pipe -g -Wall -W -D_REENTRANT  $(DEFINES)
CXXFLAGS      = -pipe -g -Wall -W -D_REENTRANT  $(DEFINES)
LEXFLAGS      = 
YACCFLAGS     = -d
INCPATH       = -I/usr/share/qt4/mkspecs/linux-g++ -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I. -I. -I.
LINK          = g++
LFLAGS        = 
LIBS          = $(SUBLIBS)  -L/usr/lib -lQtGui_debug -lQtCore_debug -lpthread
AR            = ar cqs
RANLIB        = 
QMAKE         = /usr/bin/qmake
TAR           = tar -cf
COMPRESS      = gzip -9f
COPY          = cp -f
COPY_FILE     = $(COPY)
COPY_DIR      = $(COPY) -r
INSTALL_FILE  = $(COPY_FILE)
INSTALL_DIR   = $(COPY_DIR)
DEL_FILE      = rm -f
SYMLINK       = ln -sf
DEL_DIR       = rmdir
MOVE          = mv -f
CHK_DIR_EXISTS= test -d
MKDIR         = mkdir -p

####### Output directory

OBJECTS_DIR   = ./

####### Files

SOURCES       = MainWindow.cpp \
		tabdialog.cpp \
		w_im_man.cpp \
		w_regw.cpp \
		w_cpuid.cpp \
		../cpu_functions.C \
		../cpu_console/cpu_console.C \
		../cpu_parse_display/cpu_parse.C \
		../cpu_parse_display/cpu_cpuid.C \
		../cpu_parse_display/cpu_display.C moc_tabdialog.cpp \
		moc_w_im_man.cpp \
		moc_w_pagew.cpp \
		moc_w_cpuid.cpp \
		moc_w_regw.cpp
OBJECTS       = MainWindow.o \
		tabdialog.o \
		w_im_man.o \
		w_regw.o \
		w_cpuid.o \
		cpu_functions.o \
		cpu_console.o \
		cpu_parse.o \
		cpu_cpuid.o \
		cpu_display.o \
		moc_tabdialog.o \
		moc_w_im_man.o \
		moc_w_pagew.o \
		moc_w_cpuid.o \
		moc_w_regw.o
DIST          = /usr/share/qt4/mkspecs/qconfig.pri \
		/usr/share/qt4/mkspecs/features/qt_config.prf \
		/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
		/usr/share/qt4/mkspecs/features/default_pre.prf \
		/usr/share/qt4/mkspecs/features/debug.prf \
		/usr/share/qt4/mkspecs/features/default_post.prf \
		/usr/share/qt4/mkspecs/features/warn_on.prf \
		/usr/share/qt4/mkspecs/features/qt.prf \
		/usr/share/qt4/mkspecs/features/unix/thread.prf \
		/usr/share/qt4/mkspecs/features/moc.prf \
		/usr/share/qt4/mkspecs/features/resources.prf \
		/usr/share/qt4/mkspecs/features/uic.prf \
		cpu_gui.pro
QMAKE_TARGET  = cpu_gui
DESTDIR       = 
TARGET        = cpu_gui

first: all
####### Implicit rules

.SUFFIXES: .c .o .cpp .cc .cxx .C

.cpp.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cc.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.cxx.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.C.o:
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<

.c.o:
	$(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<

####### Build rules

all:  $(TARGET)

$(TARGET):  $(OBJECTS)  
	$(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)

Makefile: cpu_gui.pro  /usr/share/qt4/mkspecs/linux-g++/qmake.conf /usr/share/qt4/mkspecs/qconfig.pri \
		/usr/share/qt4/mkspecs/features/qt_config.prf \
		/usr/share/qt4/mkspecs/features/exclusive_builds.prf \
		/usr/share/qt4/mkspecs/features/default_pre.prf \
		/usr/share/qt4/mkspecs/features/debug.prf \
		/usr/share/qt4/mkspecs/features/default_post.prf \
		/usr/share/qt4/mkspecs/features/warn_on.prf \
		/usr/share/qt4/mkspecs/features/qt.prf \
		/usr/share/qt4/mkspecs/features/unix/thread.prf \
		/usr/share/qt4/mkspecs/features/moc.prf \
		/usr/share/qt4/mkspecs/features/resources.prf \
		/usr/share/qt4/mkspecs/features/uic.prf
	$(QMAKE) -unix -o Makefile cpu_gui.pro
/usr/share/qt4/mkspecs/qconfig.pri:
/usr/share/qt4/mkspecs/features/qt_config.prf:
/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
/usr/share/qt4/mkspecs/features/default_pre.prf:
/usr/share/qt4/mkspecs/features/debug.prf:
/usr/share/qt4/mkspecs/features/default_post.prf:
/usr/share/qt4/mkspecs/features/warn_on.prf:
/usr/share/qt4/mkspecs/features/qt.prf:
/usr/share/qt4/mkspecs/features/unix/thread.prf:
/usr/share/qt4/mkspecs/features/moc.prf:
/usr/share/qt4/mkspecs/features/resources.prf:
/usr/share/qt4/mkspecs/features/uic.prf:
qmake:  FORCE
	@$(QMAKE) -unix -o Makefile cpu_gui.pro

dist: 
	@$(CHK_DIR_EXISTS) ".tmp/cpu_gui1.0.0" || $(MKDIR) ".tmp/cpu_gui1.0.0"
	$(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/cpu_gui1.0.0/ && $(COPY_FILE) --parents tabdialog.h w_im_man.h w_pagew.h w_cpuid.h w_regw.h cpu_monitor_gui.h ../cpu_common.h ../cpu_consts.h ../cpu_functions.h ../cpu_monitor.h ../cpu_console/cpu_console.h ../cpu_parse_display/cpu_parse.h ../cpu_parse_display/cpu_cpuid.h ../cpu_parse_display/cpu_display.h .tmp/cpu_gui1.0.0/ && $(COPY_FILE) --parents MainWindow.cpp tabdialog.cpp w_im_man.cpp w_regw.cpp w_cpuid.cpp ../cpu_functions.C ../cpu_console/cpu_console.C ../cpu_parse_display/cpu_parse.C ../cpu_parse_display/cpu_cpuid.C ../cpu_parse_display/cpu_display.C .tmp/cpu_gui1.0.0/ && (cd `dirname .tmp/cpu_gui1.0.0` && $(TAR) cpu_gui1.0.0.tar cpu_gui1.0.0 && $(COMPRESS) cpu_gui1.0.0.tar) && $(MOVE) `dirname .tmp/cpu_gui1.0.0`/cpu_gui1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/cpu_gui1.0.0


yaccclean:
lexclean:
clean:compiler_clean 
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) *~ core *.core


####### Sub-libraries

distclean: clean
	-$(DEL_FILE) $(TARGET) 

/usr/bin/moc-qt4:
	(cd "$(QTDIR)/src/tools/moc" && $(MAKE))

mocclean: compiler_moc_header_clean compiler_moc_source_clean

mocables: compiler_moc_header_make_all compiler_moc_source_make_all

compiler_moc_header_make_all: moc_tabdialog.cpp moc_w_im_man.cpp moc_w_pagew.cpp moc_w_cpuid.cpp moc_w_regw.cpp
compiler_moc_header_clean:
	-$(DEL_FILE) moc_tabdialog.cpp moc_w_im_man.cpp moc_w_pagew.cpp moc_w_cpuid.cpp moc_w_regw.cpp
moc_tabdialog.cpp: w_pagew.h \
		w_im_man.h \
		w_cpuid.h \
		w_regw.h \
		../cpu_consts.h \
		tabdialog.h \
		/usr/bin/moc-qt4
	/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) tabdialog.h -o moc_tabdialog.cpp

moc_w_im_man.cpp: w_pagew.h \
		w_im_man.h \
		/usr/bin/moc-qt4
	/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) w_im_man.h -o moc_w_im_man.cpp

moc_w_pagew.cpp: w_pagew.h \
		/usr/bin/moc-qt4
	/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) w_pagew.h -o moc_w_pagew.cpp

moc_w_cpuid.cpp: w_regw.h \
		w_pagew.h \
		w_cpuid.h \
		/usr/bin/moc-qt4
	/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) w_cpuid.h -o moc_w_cpuid.cpp

moc_w_regw.cpp: w_regw.h \
		/usr/bin/moc-qt4
	/usr/bin/moc-qt4 $(DEFINES) $(INCPATH) w_regw.h -o moc_w_regw.cpp

compiler_rcc_make_all:
compiler_rcc_clean:
compiler_image_collection_make_all:
compiler_image_collection_clean:
	-$(DEL_FILE) qmake_image_collection.cpp
compiler_moc_source_make_all:
compiler_moc_source_clean:
compiler_uic_make_all:
compiler_uic_clean:
compiler_clean: compiler_moc_header_clean compiler_rcc_clean compiler_image_collection_clean compiler_moc_source_clean compiler_uic_clean 

####### Compile

MainWindow.o: MainWindow.cpp ../cpu_common.h \
		../cpu_console/cpu_console.h \
		../cpu_consts.h \
		../cpu_monitor.h \
		../cpu_functions.h \
		../cpu_parse_display/cpu_display.h \
		../cpu_parse_display/cpu_cpuid.h \
		tabdialog.h \
		w_pagew.h \
		w_im_man.h \
		w_cpuid.h \
		w_regw.h

tabdialog.o: tabdialog.cpp ../cpu_consts.h \
		../cpu_functions.h \
		../cpu_monitor.h \
		../cpu_parse_display/cpu_parse.h \
		../cpu_common.h \
		tabdialog.h \
		w_pagew.h \
		w_im_man.h \
		w_cpuid.h \
		w_regw.h

w_im_man.o: w_im_man.cpp cpu_monitor_gui.h \
		../cpu_common.h \
		../cpu_functions.h \
		../cpu_consts.h \
		../cpu_monitor.h \
		w_im_man.h \
		w_pagew.h \
		../cpu_parse_display/cpu_display.h

w_regw.o: w_regw.cpp cpu_monitor_gui.h \
		../cpu_common.h \
		../cpu_functions.h \
		../cpu_consts.h \
		../cpu_monitor.h \
		w_regw.h

w_cpuid.o: w_cpuid.cpp cpu_monitor_gui.h \
		../cpu_common.h \
		../cpu_functions.h \
		../cpu_consts.h \
		../cpu_monitor.h \
		w_cpuid.h \
		w_regw.h \
		w_pagew.h \
		../cpu_parse_display/cpu_cpuid.h

cpu_functions.o: ../cpu_functions.C ../cpu_parse_display/cpu_display.h \
		../cpu_consts.h \
		../cpu_common.h \
		../cpu_monitor.h \
		../cpu_functions.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpu_functions.o ../cpu_functions.C

cpu_console.o: ../cpu_console/cpu_console.C ../cpu_console/cpu_console.h \
		../cpu_consts.h \
		../cpu_monitor.h \
		../cpu_functions.h \
		../cpu_parse_display/cpu_display.h \
		../cpu_common.h \
		../cpu_parse_display/cpu_cpuid.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpu_console.o ../cpu_console/cpu_console.C

cpu_parse.o: ../cpu_parse_display/cpu_parse.C ../cpu_parse_display/cpu_display.h \
		../cpu_consts.h \
		../cpu_common.h \
		../cpu_parse_display/cpu_parse.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpu_parse.o ../cpu_parse_display/cpu_parse.C

cpu_cpuid.o: ../cpu_parse_display/cpu_cpuid.C ../cpu_consts.h \
		../cpu_parse_display/cpu_cpuid.h \
		../cpu_common.h \
		../cpu_functions.h \
		../cpu_monitor.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpu_cpuid.o ../cpu_parse_display/cpu_cpuid.C

cpu_display.o: ../cpu_parse_display/cpu_display.C ../cpu_consts.h \
		../cpu_common.h \
		../cpu_parse_display/cpu_display.h \
		../cpu_parse_display/cpu_parse.h
	$(CXX) -c $(CXXFLAGS) $(INCPATH) -o cpu_display.o ../cpu_parse_display/cpu_display.C

moc_tabdialog.o: moc_tabdialog.cpp 

moc_w_im_man.o: moc_w_im_man.cpp 

moc_w_pagew.o: moc_w_pagew.cpp 

moc_w_cpuid.o: moc_w_cpuid.cpp 

moc_w_regw.o: moc_w_regw.cpp 

####### Install

install: clean  first FORCE
	cd ${PWD}/../cpu_driver && $(MAKE)
	cd ${PWD}/../cpu_driver && sudo ${PWD}/../cpu_driver/cpu_monitor.init start
	cd ${PWD}
uninstall:
	cd ${PWD}
	-$(DEL_FILE) $(OBJECTS)
	-$(DEL_FILE) *~ core *.core
	-$(DEL_FILE) *moc*
	-$(DEL_FILE) *.gz
	-$(DEL_FILE) $(TARGET) 
	cd ${PWD}/../cpu_driver && sudo ${PWD}/../cpu_driver/cpu_monitor.init stop
	cd ${PWD}
load:
	cd ${PWD}/../cpu_driver && sudo ${PWD}/../cpu_driver/cpu_monitor.init start
	cd ${PWD}
FORCE: 

